// Licensed to Elasticsearch B.V under one or more agreements.
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
// See the LICENSE file in the project root for more information.
//
// ███╗   ██╗ ██████╗ ████████╗██╗ ██████╗███████╗
// ████╗  ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝
// ██╔██╗ ██║██║   ██║   ██║   ██║██║     █████╗
// ██║╚██╗██║██║   ██║   ██║   ██║██║     ██╔══╝
// ██║ ╚████║╚██████╔╝   ██║   ██║╚██████╗███████╗
// ╚═╝  ╚═══╝ ╚═════╝    ╚═╝   ╚═╝ ╚═════╝╚══════╝
// ------------------------------------------------
//
// This file is automatically generated.
// Please do not edit these files manually.
//
// ------------------------------------------------

#nullable restore

using Elastic.Clients.Elasticsearch.Fluent;
using Elastic.Clients.Elasticsearch.Requests;
using Elastic.Clients.Elasticsearch.Serialization;
using Elastic.Transport;
using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using System.Text.Json;
using System.Text.Json.Serialization;

namespace Elastic.Clients.Elasticsearch.MachineLearning;

public sealed partial class UpgradeJobSnapshotRequestParameters : RequestParameters
{
	/// <summary>
	/// <para>Controls the time to wait for the request to complete.</para>
	/// </summary>
	public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q<Elastic.Clients.Elasticsearch.Duration?>("timeout"); set => Q("timeout", value); }

	/// <summary>
	/// <para>When true, the API won’t respond until the upgrade is complete.<br/>Otherwise, it responds as soon as the upgrade task is assigned to a node.</para>
	/// </summary>
	public bool? WaitForCompletion { get => Q<bool?>("wait_for_completion"); set => Q("wait_for_completion", value); }
}

/// <summary>
/// <para>Upgrades an anomaly detection model snapshot to the latest major version.<br/>Over time, older snapshot formats are deprecated and removed. Anomaly<br/>detection jobs support only snapshots that are from the current or previous<br/>major version.<br/>This API provides a means to upgrade a snapshot to the current major version.<br/>This aids in preparing the cluster for an upgrade to the next major version.<br/>Only one snapshot per anomaly detection job can be upgraded at a time and the<br/>upgraded snapshot cannot be the current snapshot of the anomaly detection<br/>job.</para>
/// </summary>
public sealed partial class UpgradeJobSnapshotRequest : PlainRequest<UpgradeJobSnapshotRequestParameters>
{
	public UpgradeJobSnapshotRequest(Elastic.Clients.Elasticsearch.Id jobId, Elastic.Clients.Elasticsearch.Id snapshotId) : base(r => r.Required("job_id", jobId).Required("snapshot_id", snapshotId))
	{
	}

	internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningUpgradeJobSnapshot;

	protected override HttpMethod StaticHttpMethod => HttpMethod.POST;

	internal override bool SupportsBody => false;

	internal override string OperationName => "ml.upgrade_job_snapshot";

	/// <summary>
	/// <para>Controls the time to wait for the request to complete.</para>
	/// </summary>
	[JsonIgnore]
	public Elastic.Clients.Elasticsearch.Duration? Timeout { get => Q<Elastic.Clients.Elasticsearch.Duration?>("timeout"); set => Q("timeout", value); }

	/// <summary>
	/// <para>When true, the API won’t respond until the upgrade is complete.<br/>Otherwise, it responds as soon as the upgrade task is assigned to a node.</para>
	/// </summary>
	[JsonIgnore]
	public bool? WaitForCompletion { get => Q<bool?>("wait_for_completion"); set => Q("wait_for_completion", value); }
}

/// <summary>
/// <para>Upgrades an anomaly detection model snapshot to the latest major version.<br/>Over time, older snapshot formats are deprecated and removed. Anomaly<br/>detection jobs support only snapshots that are from the current or previous<br/>major version.<br/>This API provides a means to upgrade a snapshot to the current major version.<br/>This aids in preparing the cluster for an upgrade to the next major version.<br/>Only one snapshot per anomaly detection job can be upgraded at a time and the<br/>upgraded snapshot cannot be the current snapshot of the anomaly detection<br/>job.</para>
/// </summary>
public sealed partial class UpgradeJobSnapshotRequestDescriptor : RequestDescriptor<UpgradeJobSnapshotRequestDescriptor, UpgradeJobSnapshotRequestParameters>
{
	internal UpgradeJobSnapshotRequestDescriptor(Action<UpgradeJobSnapshotRequestDescriptor> configure) => configure.Invoke(this);

	public UpgradeJobSnapshotRequestDescriptor(Elastic.Clients.Elasticsearch.Id jobId, Elastic.Clients.Elasticsearch.Id snapshotId) : base(r => r.Required("job_id", jobId).Required("snapshot_id", snapshotId))
	{
	}

	internal override ApiUrls ApiUrls => ApiUrlLookup.MachineLearningUpgradeJobSnapshot;

	protected override HttpMethod StaticHttpMethod => HttpMethod.POST;

	internal override bool SupportsBody => false;

	internal override string OperationName => "ml.upgrade_job_snapshot";

	public UpgradeJobSnapshotRequestDescriptor Timeout(Elastic.Clients.Elasticsearch.Duration? timeout) => Qs("timeout", timeout);
	public UpgradeJobSnapshotRequestDescriptor WaitForCompletion(bool? waitForCompletion = true) => Qs("wait_for_completion", waitForCompletion);

	public UpgradeJobSnapshotRequestDescriptor JobId(Elastic.Clients.Elasticsearch.Id jobId)
	{
		RouteValues.Required("job_id", jobId);
		return Self;
	}

	public UpgradeJobSnapshotRequestDescriptor SnapshotId(Elastic.Clients.Elasticsearch.Id snapshotId)
	{
		RouteValues.Required("snapshot_id", snapshotId);
		return Self;
	}

	protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings)
	{
	}
}